<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./lib/react.development.js"></script>
    <script src="./lib/react-dom.development.js"></script>
    <script src="./lib/babel.min.js"></script>
</head>
<body>
    <div id="root"></div>
</body>
<script type="text/babel">
    const root = ReactDOM.createRoot(document.querySelector("#root"));
    /**
     *  1. if ... else
     *  2. 三元表达式
     *  3. 逻辑运算
     *  4. 封装函数
     * 
     *  插值表达式可以渲染react元素
     * 
     */
    
    const div = (
        <div>
            <h3>我是react元素div</h3>
        </div>
    )

    let oElement = null;
    let isLoading = true;
    if(isLoading){
        oElement = <h3>页面正在加载中......</h3>
    }else{
        oElement = <div>加载完毕，用户列表</div>
    }
    let age = 18;
    function fn(age){
        let oE = null;
        if(age < 18){
            oE = <div>未成年人请在家长的陪同下在观看</div>
        }else if(age < 30){
            oE = <div>观看本内容请确认老婆不在身边!</div>
        }else if(age < 60){
            oE = <div>......</div>
        }else{
            oE = <div>?????</div>
        }
        return oE
    }

    root.render((
        <div>
            {div}
            {oElement}
            {isLoading ? <h3>页面正在加载中....</h3> : <div>加载完毕，用户列表</div>}
            {isLoading && <h3>页面正在加载中</h3>}
            {fn(31)}
        </div>
    ))
</script>
</html>